﻿<ResourceDictionary
	xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
	xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:Microsoft_Windows_Themes="clr-namespace:Microsoft.Windows.Themes;assembly=PresentationFramework.Aero">
	<!-- Resource dictionary entries should be defined here. -->
	<LinearGradientBrush x:Key="ProgressBarBackground" EndPoint="0,1" StartPoint="0,0">
		<GradientStop Color="#626262" Offset="1"/>
		<GradientStop Color="#4c4c4c" Offset="0"/>
	</LinearGradientBrush>
	<LinearGradientBrush x:Key="ProgressBarBorderBrush" EndPoint="0,1" StartPoint="0,0">
		<GradientStop Color="#B2B2B2" Offset="0"/>
		<GradientStop Color="#8C8C8C" Offset="1"/>
	</LinearGradientBrush>
	<LinearGradientBrush x:Key="IndicatorBrush" EndPoint="0,1" StartPoint="0,0">
		<GradientStop Color="#727272" Offset="0"/>
		<GradientStop Color="#4c4c4c" Offset="1"/>
	</LinearGradientBrush>
	<LinearGradientBrush x:Key="ProgressBarGlassyHighlight" EndPoint="0,1" StartPoint="0,0">
		<GradientStop Color="#50FFFFFF" Offset="0.5385"/>
		<GradientStop Color="#00FFFFFF" Offset="0.5385"/>
	</LinearGradientBrush>
	<LinearGradientBrush x:Key="ProgressBarTopHighlight" EndPoint="0,1" StartPoint="0,0">
		<GradientStop Color="#80FFFFFF" Offset="0.05"/>
		<GradientStop Color="#00FFFFFF" Offset="0.25"/>
	</LinearGradientBrush>
	<LinearGradientBrush x:Key="ProgressBarIndicatorAnimatedFill2" EndPoint="0,0" StartPoint="-100,0" MappingMode="Absolute">
		<GradientStop Color="#00000000" Offset="0"/>
		<GradientStop Color="#FF000000" Offset="0.4"/>
		<GradientStop Color="#FF000000" Offset="0.6"/>
		<GradientStop Color="#00000000" Offset="1"/>
	</LinearGradientBrush>
	
	 <DrawingBrush x:Key="ProgressBarIndicatorAnimatedFill">
        <DrawingBrush.Drawing>
            <DrawingGroup>
				<GeometryDrawing>
					<GeometryDrawing.Geometry>
                        <RectangleGeometry Rect="0,0 1,1" />
                    </GeometryDrawing.Geometry>
						<GeometryDrawing.Brush>
							<RadialGradientBrush RadiusX="0.2" RadiusY="1" Center="0.5,1.2" GradientOrigin="0.5,1.2">
								<RadialGradientBrush.GradientStops>
									<GradientStop Color="#00000000" Offset="0"/>
									<GradientStop Color="#FF000000" Offset="0.4"/>
									<GradientStop Color="#00000000" Offset="1"/>
								</RadialGradientBrush.GradientStops>
								<RadialGradientBrush.RelativeTransform>
									<TransformGroup/>
								</RadialGradientBrush.RelativeTransform>
							</RadialGradientBrush>
						</GeometryDrawing.Brush>
					</GeometryDrawing>
            </DrawingGroup>
        </DrawingBrush.Drawing>
    </DrawingBrush>


	<LinearGradientBrush x:Key="GlassBrush" EndPoint="0,1" StartPoint="0,0">
		<GradientStop Color="#96FFFFFF" Offset="0"/>
		<GradientStop Color="#28FFFFFF" Offset="0.5"/>
		<GradientStop Color="#00FFFFFF" Offset="0.5"/>
	</LinearGradientBrush>
	
	<LinearGradientBrush x:Key="ProgressBarIndicatorDarkEdgeLeft" EndPoint="1,0" StartPoint="0,0">
		<GradientStop Color="#0C000000" Offset="0"/>
		<GradientStop Color="#20000000" Offset="0.3"/>
		<GradientStop Color="#00000000" Offset="1"/>
	</LinearGradientBrush>
	<LinearGradientBrush x:Key="ProgressBarIndicatorDarkEdgeRight" EndPoint="1,0" StartPoint="0,0">
		<GradientStop Color="#96FFFFFF" Offset="0"/>
		<GradientStop Color="#28FFFFFF" Offset="0.5"/>
		<GradientStop Color="#00FFFFFF" Offset="0.5"/>
	</LinearGradientBrush>
	<RadialGradientBrush x:Key="ProgressBarIndicatorLightingEffectLeft" RelativeTransform="1,0,0,1,0.5,0.5" RadiusX="1" RadiusY="1">
		<GradientStop Color="#96FFFFFF" Offset="0"/>
		<GradientStop Color="#28FFFFFF" Offset="0.5"/>
		<GradientStop Color="#00FFFFFF" Offset="0.5"/>
	</RadialGradientBrush>
	<LinearGradientBrush x:Key="ProgressBarIndicatorLightingEffect" EndPoint="0,0" StartPoint="0,1">
		<GradientStop Color="#60FFFFC4" Offset="0"/>
		<GradientStop Color="#00FFFFC4" Offset="1"/>
	</LinearGradientBrush>
	<RadialGradientBrush x:Key="ProgressBarIndicatorLightingEffectRight" RelativeTransform="1,0,0,1,-0.5,0.5" RadiusX="1" RadiusY="1">
		<GradientStop Color="#60FFFFC4" Offset="0"/>
		<GradientStop Color="#00FFFFC4" Offset="1"/>
	</RadialGradientBrush>
	<LinearGradientBrush x:Key="ProgressBarIndicatorGlassyHighlight" EndPoint="0,1" StartPoint="0,0">
		<GradientStop Color="#90FFFFFF" Offset="0.5385"/>
		<GradientStop Color="#00FFFFFF" Offset="0.5385"/>
	</LinearGradientBrush>
	<Style TargetType="{x:Type ProgressBar}">
		<Setter Property="Foreground" Value="#01D328"/>
		<Setter Property="Background" Value="{StaticResource ProgressBarBackground}"/>
		<Setter Property="BorderBrush" Value="{StaticResource ProgressBarBorderBrush}"/>
		<Setter Property="BorderThickness" Value="1"/>
		<Setter Property="MinHeight" Value="20"/>
		<Setter Property="Margin" Value="5"/>
		<Setter Property="Template">
			<Setter.Value>
				<ControlTemplate TargetType="{x:Type ProgressBar}">
					<Grid SnapsToDevicePixels="true" x:Name="Background">
						<Rectangle Fill="{TemplateBinding Background}" RadiusX="5" RadiusY="5"/>
						<Rectangle Margin="1" x:Name="PART_Track"/>
						<Decorator HorizontalAlignment="Left" Margin="1" x:Name="PART_Indicator">
							<Grid x:Name="Foreground">
								<Grid.ColumnDefinitions>
									<ColumnDefinition MaxWidth="15"/>
									<ColumnDefinition Width="0.1*"/>
									<ColumnDefinition MaxWidth="15"/>
								</Grid.ColumnDefinitions>
								<Grid.RowDefinitions>
									<RowDefinition/>
									<RowDefinition/>
								</Grid.RowDefinitions>
								<Border x:Name="Indicator" Grid.ColumnSpan="3" Grid.RowSpan="2" Background="{StaticResource IndicatorBrush}" BorderThickness="0,1,1,0" Margin="-1" BorderBrush="{StaticResource ProgressBarBorderBrush}" CornerRadius="2"/>
								<Border x:Name="Glass" Grid.ColumnSpan="3" Grid.RowSpan="2" Margin="1" Background="{StaticResource GlassBrush}" CornerRadius="2"/>
								<Rectangle x:Name="Animation" Grid.ColumnSpan="3" Grid.RowSpan="2" Fill="#FFAA0000">
									<Rectangle.OpacityMask>
										<MultiBinding>
											<MultiBinding.Converter>
												<Microsoft_Windows_Themes:ProgressBarHighlightConverter/>
											</MultiBinding.Converter>
											<Binding Source="{StaticResource ProgressBarIndicatorAnimatedFill}"/>
											<Binding Path="ActualWidth" ElementName="Background"/>
											<Binding Path="ActualHeight" ElementName="Background"/>
										</MultiBinding>
									</Rectangle.OpacityMask>
								</Rectangle>
								<Rectangle Fill="Transparent" RadiusX="1" RadiusY="1" Margin="1,1,0,1" x:Name="LeftDark" Grid.RowSpan="2"/>
								<Rectangle Fill="Transparent" RadiusX="1" RadiusY="1" Margin="0,1,1,1" x:Name="RightDark" Grid.Column="2" Grid.RowSpan="2"/>
								<Rectangle Fill="Transparent" x:Name="LeftLight" Grid.Column="0" Grid.Row="2"/>
								<Rectangle Fill="Transparent" x:Name="CenterLight" Grid.Column="1" Grid.Row="2"/>
								<Rectangle Fill="Transparent" x:Name="RightLight" Grid.Column="2" Grid.Row="2"/>
							</Grid>
						</Decorator>
						<Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" CornerRadius="2"/>
						<Grid x:Name="GridValue" HorizontalAlignment="Center" VerticalAlignment="Center">
							<Grid.ColumnDefinitions>
								<ColumnDefinition Width="Auto"/>
								<ColumnDefinition Width="Auto"/>
							</Grid.ColumnDefinitions>
							<Label Grid.Column="0" Padding="0" Foreground="White" Content="{TemplateBinding Value}" />
							<Label Grid.Column="1" Padding="0" Foreground="White" Content="%" />
						</Grid>
					</Grid>
					<ControlTemplate.Triggers>
						<Trigger Property="Orientation" Value="Vertical">
							<Setter Property="LayoutTransform" TargetName="Background">
								<Setter.Value>
									<RotateTransform Angle="-90"/>
								</Setter.Value>
							</Setter>
							<Setter Property="LayoutTransform" TargetName="PART_Track">
								<Setter.Value>
									<RotateTransform Angle="90"/>
								</Setter.Value>
							</Setter>
							<Setter Property="LayoutTransform" TargetName="PART_Indicator">
								<Setter.Value>
									<RotateTransform Angle="90"/>
								</Setter.Value>
							</Setter>
							<Setter Property="LayoutTransform" TargetName="Foreground">
								<Setter.Value>
									<RotateTransform Angle="-90"/>
								</Setter.Value>
							</Setter>
						</Trigger>
						<Trigger Property="IsIndeterminate" Value="true">
							<Setter Property="Visibility" TargetName="LeftDark" Value="Collapsed"/>
							<Setter Property="Visibility" TargetName="RightDark" Value="Collapsed"/>
							<Setter Property="Visibility" TargetName="LeftLight" Value="Collapsed"/>
							<Setter Property="Visibility" TargetName="CenterLight" Value="Collapsed"/>
							<Setter Property="Visibility" TargetName="RightLight" Value="Collapsed"/>
							<Setter Property="Visibility" TargetName="Indicator" Value="Collapsed"/>
							<Setter Property="Background" TargetName="Glass" Value="Transparent"/>
							<Setter Property="Visibility" TargetName="GridValue" Value="Collapsed"/>
						</Trigger>
						<Trigger Property="IsIndeterminate" Value="false">
							<Setter Property="Fill" TargetName="Animation" Value="#FFAA0000"/>
						</Trigger>
					</ControlTemplate.Triggers>
				</ControlTemplate>
			</Setter.Value>
		</Setter>
	</Style>
</ResourceDictionary>